<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<script type="text/javascript" src="scripts/boot.js"></script>
	
	<style type="text/css">
	    .errorText
	    {
	        color:red;
	    }
	    .Delete_Button
        {
            font-size:11px;color:#1B3F91;font-family:Verdana;  
            margin-right:5px;          
        }
    </style>
</head>
<body>
	<fieldset style="border:solid 1px #aaa;padding:3px;">
		<legend >订单基本信息</legend>
		<form id="form1" method="post">
	        <table cellspacing="10" cellpadding="0">
	        	<tr>
	        		<td style="width:130px;" align="right">
	        			收货人：
	        		</td>
	        		<td >
	        			<input name="name" style="width: 130px;" class="mini-textbox" enabled="false"/>
	        		</td>
	        		<td style="width:90px;" align="right">
	        			联系电话：
	        		</td>
	        		<td>
	        			<input name="contactNo" style="width: 130px;" class="mini-textbox" enabled="false" />
	        		</td>
	        	</tr>
	        	<tr>
	        		<td align="right">
	        			地址：
	        		</td>
	        		<td colspan="4">
	        			<input  name="provinceId" id="province_val" class="mini-hidden"/>
			      		<input style="width: 130px;" id="province" name="pName" class="mini-textbox" onfocus="focusP" emptyText="请选择省份" enabled="false"/>
			      		<input name="cityId" class="mini-hidden" id="city_val" />
			      		<input class="mini-textbox" id="city" name="cName" style="width: 130px;" readOnly="true" emptyText="请选择城市" enabled="false"/>
			      		<input name="districtId" id="district_val" class="mini-hidden"/>
			      		<input class="mini-textbox" id="district" name="dName" style="width: 130px;" readOnly="true" emptyText="请选择区县" enabled="false"/>
	        		</td>
	        	</tr>
	        	<tr>
	        		<td align="right">
	        			详细地址：
	        		</td>
	        		<td colspan="2">
	        			<input name="address" class="mini-textbox" style="width:265px;" enabled="false"/>
	        		</td>
	        		<td style="width:90px;" align="right">
	      				邮编：
	        		</td>
	        		<td>
	      				<input class="mini-textbox" name="zipCode" style="width: 130px;" enabled="false"/>
	        		</td>
	        	</tr>
	        	<tr>
	        		<td align="right">
	        			备注：
	        		</td>
	        		<td colspan="4">
	        			<input class="mini-textbox" name="ordersRemark" style="width: 510px;" enabled="false"/>
	        		</td>
	        	</tr>
	        	<tr>
	        		<td align="right">
	        			是否开发票：
	        		</td>
	        		<td colspan="2">
	        			<input name="invoice" style="width: 130px;" class="mini-combobox" valueField="keyName" textField="keyValue"
	               			url="dictionary_om_key_val_view.do?typeName=ORDER_INVOICE_TYPE" enabled="false"/>
	        		</td>
	        		<td align="right">
	        			媒体：
	        		</td>
	        		<td>
	        			<input name="mediaId" style="width: 130px;" class="mini-combobox" valueField="id" textField="name"
	               			url="pro_sales_stat_find_media.do" enabled="false"/>
	        		</td>
	        	</tr>
	        	<tr>
	        		<td align="right">
	        			订单性质：
	        		</td>
	        		<td colspan="2">
	        			<input name="nature" style="width: 130px;" class="mini-combobox" valueField="keyName" textField="keyValue"
	               			url="dictionary_om_key_val_view.do?typeName=ORDER_NATURE_TYPE" enabled="false"/>
	        		</td>
	        		<td align="right">
	        			物流公司：
	        		</td>
	        		<td>
	        			<input name="expressId" style="width: 130px;" class="mini-combobox" valueField="id" textField="name"
	               			url="orders_find_logistics_view.do" enabled="false"/>
	        		</td>
	        	</tr>
	        	<tr>
	        		<td align="right">
	        			支付方式：
	        		</td>
	        		<td colspan="2">
	        			<input name="payType" style="width: 130px;" class="mini-combobox" valueField="keyName" textField="keyValue"
	               			url="dictionary_om_key_val_view.do?typeName=ORDER_PAY_TYPE" enabled="false"/>
	        		</td>
	        	</tr>
	        	<tr>
	        		<td align="right">
	        			货款：
	        		</td>
	        		<td colspan="4">
	        			<input class="mini-textbox" name="payment" style="width: 60px;" enabled="false"/>
	        			<span style="margin-left: 84px;">运费：</span>
	        			<input class="mini-textbox" name="freight" style="width: 60px;" enabled="false"/>
	        		</td>
	        	</tr>
	        	<tr>
	        		<td align="right" >
	        			应收金额：
	        		</td>
	        		<td colspan="4">
	        			<input class="mini-textbox" name="receivable" style="width: 60px;" enabled="false"/>
	        			<span style="margin-left: 60px;">实收金额：</span>
	        			<input class="mini-textbox" name="amountPaid" style="width: 60px;" enabled="false"/>
	        			<span style="margin-left: 45px;">本单后余额：</span>
	        			<input class="mini-textbox" name="money" style="width: 60px;margin-left: 5px;" enabled="false"/>
	        		</td>
	        	</tr>
	        	<tr>
	        		<td align="right" >
	        			本单使用积分：
	        		</td>
	        		<td colspan="4">
	        			<input class="mini-textbox" name="usePoints" style="width: 60px;" enabled="false"/>
	        			<span style="margin-left: 60px;">本单积分：</span>
	        			<input class="mini-textbox" name="points" style="width: 60px;" enabled="false"/>
	        			<span style="margin-left: 45px;">本单后积分：</span>
	        			<input class="mini-textbox" name="integral" style="width: 60px;margin-left: 5px;" enabled="false"/>
	        		</td>
	        	</tr>
	        	<tr>
	        		<td align="right" >
	        			本单使用红包：
	        		</td>
	        		<td colspan="4">
	        			<input class="mini-textbox" name="useRed" style="width: 60px;" enabled="false"/>
	        			<span style="margin-left: 60px;">本单红包：</span>
	        			<input class="mini-textbox" name="red" style="width: 60px;" enabled="false"/>
	        			<span style="margin-left: 45px;">本单后红包：</span>
	        			<input class="mini-textbox" name="redEnvelopes" style="width: 60px;margin-left: 5px;" enabled="false"/>
	        		</td>
	        	</tr>
	        </table>
	    </form>
	</fieldset>
	<fieldset style="border:solid 1px #aaa;padding:3px;">
		<legend >订单产品信息</legend>
		<div id="datagrid1" class="mini-datagrid" style="width:800px;height:auto;" showPager="false" allowResize="false" url="maintain_orders_find_product.do" idField="id">
	        <div property="columns">
	            <div field="medicineName" width="8%" headerAlign="center" allowSort="true">名称</div>                
	            <div field="quantity" width="5%" allowSort="true" renderer="onGenderRenderer" align="center" headerAlign="center">数量</div>            
	            <div field="prePrice" width="5%" allowSort="true">价格</div>
	            <div field="freight" width="5%" allowSort="true" dateFormat="yyyy-MM-dd">运费</div>
	            <div field="usePoints" width="5%" headerAlign="center" allowSort="true">积分抵扣</div>                
	            <div field="useRed" width="5%" headerAlign="center" allowSort="true">红包抵扣</div>                
	            <div field="totalPrice" width="5%" headerAlign="center" allowSort="true">实际价格</div>                
	            <div field="premiums" width="5%" headerAlign="center" allowSort="true">赠品</div>                
	            <div field="ridePin" width="5%" headerAlign="center" allowSort="true">搭销</div>                
	        </div>
    	</div>    
        <input class="mini-hidden" name="ordersId" id="orders_id" value="<s:property value='id'/>"/>
	</fieldset>
	<div style="text-align:center;padding:15px;margin-top: 15px;">               
	    <a class="mini-button" onclick="onCancel" style="width:150px;">取消</a>       
    </div>
<!--     取消弹窗 -->
    <div id="win1" class="mini-window" allowDrag="false" showHeader="true" title="订单审核后取消" style="width: 310px;height: 150px;">
	    <div id="reason_type" emptyText="请选择原因类别" labelField="true" label="类别：" labelStyle="width: 60px;" class="mini-combobox" style="width:250px; margin-left: 15px;margin-top: 10px;" popupWidth="170"
	     	textField="keyValue" valueField="keyName" showModal="true" url="dictionary_om_key_val_view.do?typeName=CANCEL_REASON_TYPE" showClose="true" oncloseclick="onCloseClick" required="true" >
		</div>
		<input labelField="true" labelStyle="width: 60px;" style="margin-left: 15px;margin-top: 10px;" label="备注：" id="reason_remark" class="mini-textbox" />
		<div style="text-align:center;margin-top: 10px;">
			<a class="mini-button" onclick="onOk1" style="">确定</a>
			<a class="mini-button" onclick="onClose1" style="margin-left: 50px;">关闭</a>
		</div>
	</div>
    
</body>
</html>

<script type="text/javascript">
	mini.parse();
	var form1 = new mini.Form("form1");
	
 	var grid = mini.get("datagrid1");
 	var ordersId = mini.get("orders_id");
	function SetData(data) {
		data = mini.clone(data);
		$.post("maintain_orders_detail_view.do", {id: ordersId.getValue()}, function(data){
			form1.setData(data.ordersStorage);
			console.info(data.ordersStorage);
			grid.load({id: data.ordersStorage.id });
			ordersId.setValue(data.ordersStorage.id);
			top["win"].setCid(data.ordersStorage.customerId);
		}, "json");
	}
	
	function onCloseClick(e){
		var obj = e.sender;
        obj.setText("");
        obj.setValue("");
	}
	
	var win1 = mini.get("win1");
	var reasonType = mini.get("reason_type");
	// 订单取消
	function onCancel() {
		win1.showAtPos("center", "middle");
	}
	
	function onOk1(){
		var form3 = new mini.Form("win1");
		form3.validate();
	    if (form3.isValid() == false) return;
		var reasonRemark = mini.get("reason_remark");
		$.post("cancel_cancel.do", {id: ordersId.getValue(), reasonType: reasonType.getValue(), reasonRemark: reasonRemark.getValue()}, function(data) {
			if(data.success == "true") {
				top["win"].closeTabs("cancel");
			}else if (data.success == "fail"){
				mini.alert("订单已发货，无法取消！");
			} else {
				mini.alert("取消失败，订单id不能为空");
			}
		}, "json");
	}
	
	function onClose1(e){
		reasonType.setValue("");
		win1.hide();
	}
</script>